package main

import (
	"fmt"
	"reflect"
)

/*
普通的类型断言
	https://gitee.com/super__man/gostudycode/tree/master/assertion
*/

type MySlice[T interface{}] []T

func main() {

	s := MySlice[int]{1, 2, 3}

	for _, v := range s {
		v := reflect.ValueOf(v)
		switch v.Kind() {
		case reflect.Int:
			fmt.Println("int 类型")
		case reflect.String:
			fmt.Println("string 类型")
		}
	}

	/*
		s := []interface{}{1, "123"}
		for _, v := range s {
			fmt.Printf("%T\n", v)
			switch v.(type) {
			case int:
				fmt.Println("这是个 int 类型")
			case string:
				fmt.Println("这是 字符串 类型")

			}

		}

	*/

}
